<?php namespace Common\Model;
use Hdphp\Model\Model;
class Order_list extends Model{
	//指定表名
	protected $table='order_list';
	
	//购物车->添加订单列表
	public function store($goid){
		foreach($_SESSION['cart']['goods'] as $k=>$v){
			$this->data['shop_goods_gid']=$v['id'];
			$this->data['shop_goodsorder_goid']=$goid;
			$this->data['olnum']=$v['num'];
			$this->data['oltotal']=$v['total'];
			$this->data['options']=implode(',', $v['options']);
			$this->add($this->data);
		}
		return TRUE;
	}
	//内容页->添加订单列表
	public function addList(){
		//添加订单列表
		$goodsList=Q('post.goodsList');	
		$gid=$goodsList['shop_goods_gid'];
		//对货品详情进行修改
		$goodsList['options']=substr($goodsList['options'], 0,strlen($goodsList['options'])-1);
		$goodsList['options']=str_replace('|', ',', $goodsList['options']);
		//查询货品详情对应的值
		$goods_attrModel=new Goods_attr;
		$options=$goods_attrModel
				->join('type_attr','shop_type_attr_taid','=','taid')
				->where("gaid IN (".$goodsList['options'].") AND shop_goods_gid={$gid}")
				->get();
		foreach($options as $k=>$v){
			$options[$k]="{$v['taname']}:{$v['gavalue']}";
		}
		$goodsList['options']=implode(',', $options);
		$this->add($goodsList);
	}
}
 ?>